
let mongoose = require("mongoose");
let Schema = mongoose.Schema;
let gradeSchema = new Schema({
    name: {
        type: String,
        require: true,
    },
    class: {
        type: String,
        enum: ["2301", "2302", "2303", "2304", "2305"],
    },
    chinese: {
        type: Number,
        min: 0,
        max: 100,
    },
    math: {
        type: Number,
        min: 0,
        max: 100,
    },
    english: {
        type: Number,
        min: 0,
        max: 100,
    },
    update_time: {
        type: String,
        default: new Date().toLocaleString()
    }
})

// 链接mongodb数据库中的集合 (没有就新增)
let Grade = mongoose.model("grade", gradeSchema);

module.exports = Grade;